package cb.wzby;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class Set1 {
    public static void main(String[] args) {
        //Set s1 = new HashSet();
        //没有使用泛型，不推荐
        Set<String> s2 = new HashSet<>();
        //Collections<Integer> s3 = new HashSet<>();
        s2.add("java");
        s2.add("ok");
        s2.add("java");
        s2.add("java");
        s2.add("java");
        System.out.println(s2);
        System.out.println(s2.size());
        Set<User> s4 = new HashSet<>();
        s4.add(new User(1,"a",10));
        s4.add(new User(1,"b",10));
        s4.add(new User(1,"a",10));
        s4.add(new User(1,"d",150));
        s4.add(new User(1,"e",90));
        System.out.println(s4);
        System.out.println(s4);
        System.out.println(s4.size());
        //消除相同重复
    }
}
